<template>
     <div class="marLR20 marT20">
         <div class="noticeDetailWrapper">
            <h2>{{noticeTitle}}</h2>
            <p class="releasedTime">{{noticeReleaseTime}}</p>
            <div class="noticeContent" v-html = "noticeContent">
            </div>
         </div>
    </div>
</template>

<script>
import http from '@/assets/js/http'
import _g from '@/assets/js/global'

export default {
    data(){
        return {
            noticeId : null,//   公告id

            noticeTitle : '',//..公告标题
            noticeContent : '',//..公告内容
            noticeReleaseTime : '',//..公告发布时间
        }
    },
    created () {
        this.noticeId = this.$route.query.noticeId
        this.getNotice()
    },
    methods: {
        /* 获取单条公告信息 */
        getNotice(){
            const that = this
            const noticeId = that.noticeId
            let chekedDepartIdsArr = []//  选中的部门id集合数组
            _g.showLoading('加载中');
            this.apiPost("admin/notice/getNotice",{noticeId}).then(res => {
                    _g.showLoading().close()
                    if(typeof res === 'string'){
                    res = JSON.parse(res)
                    }
                    if (res.code != 200) {
                    this.handleError(res)
                    } else {
                        if(res.data.isSuccess === 0){    
                            that.noticeTitle = res.data.notice.notice_title
                            that.noticeReleaseTime = res.data.notice.notice_release_time
                            that.noticeContent = res.data.notice.notice_content
                        }else if(res.data.isSuccess === 1){
                            _g.toastMsg("error", res.message)
                        }else if(res.data.isSuccess === 2){
                            _g.toastMsg("warning", res.message)
                        }
                }
            })
        },
    },
    mixins: [http]
}
</script>

<style lang="less" scoped>
.noticeDetailWrapper{
    h2{
        color: #1c2438;
        font-size: 30px;
        margin-top: 48px;
        text-align: center;
    }
    .releasedTime{
        margin-top: 24px;
        padding-bottom: 24px;
        border-bottom: 1px dashed #e1e6eb;
        font-size: 14px;
        color: #80848f;
        text-align: center;
    }
    .noticeContent{
        margin-top: 40px;
        max-width: 1000px;
        margin-left: auto;
        margin-right: auto;
    }
}

</style>


